using UnityEngine;

namespace UFrame
{
    public class MeshRenderTool
    {
        public static void Replace(MeshRenderer mr, Material[] applyMaterial)
        {
            mr.materials = applyMaterial;
        }

        public static void IncreaseMaterial(MeshRenderer mr, Material[] applyMaterial)
        {
            mr.materials = applyMaterial;
            int len = mr.materials.Length;
            int maxLen = len + applyMaterial.Length;
            var newMaterial = new Material[maxLen];

            for (int i = 0; i < len; ++i)
            {
                newMaterial[i] = mr.materials[i];
            }

            for (int i = 0; i < applyMaterial.Length; ++i)
            {
                newMaterial[len + i] = applyMaterial[i];
            }

        }
    }
}